<div class="listArea l">
  <div class="grybox">
    <h3>Offer List - <?php echo $type; ?></h3>
    
    <?php
    $arrCinemaList = CINEMATable::getInstance()->findAllArray(sfContext::getInstance()->getUser()->getAttribute('merchant_id'), true, false);
    ?>    
    <?php include_partial('global/pager', array('pager' => $pager, 'sort' => array(
    OfferForm::SORT_SESSION_TIME => 'Session Time',
    OfferForm::SORT_CODE => 'Code',
    OfferForm::SORT_CINEMA => 'Cinema',
    OfferForm::SORT_MOVIE => 'Movie',
    OfferForm::SORT_VALID_FROM => 'Valid From',
    OfferForm::SORT_VALID_TO => 'Valid To',
    OfferForm::SORT_TICKET_PRICE => 'Ticket Price',
    OfferForm::SORT_SEATS_COUNT => 'Seats Count',
    OfferForm::SORT_FILLED => '% Filled',
    OfferForm::SORT_CREATED_AT => 'Created Date'), 'sort2' => $arrCinemaList, 'sort2Label' => 'Cinema')) ?>

    <div class="listBox" style="clear:both;">
      <div class="listWarp3">Code</div>
      <div class="listWarp2">Cinema</div>
      <div class="listWarp1">Movie</div>
      <div class="listWarp3">Sold</div>
      <div class="listWarp3">% Filled</div>
    </div>
    <div class="listBoxWht">
      <?php if ($pager->getNbResults()) : ?>
      <?php $expired = (strstr($type, 'Expired') !== false) ? '&type=expired' : ''; ?>
      <?php foreach ($pager->getResults() as $offer) : ?>
      <div class="frmRow<?php if ($offer->getStatus() == Constants::STATUS_INACTIVE) : ?> frmRowInactive<?php endif; ?>">
        <div class="listWarp3"><?php echo $offer->getCode(); ?></div>
        <div class="listWarp2"><?php echo $offer->getCINEMA()->getName (); ?></div>
        <div class="listWarp1"><?php echo $offer->getMOVIE()->getTitle(); ?></div>
        <div class="listWarp3"><?php echo ($offer->getSeatsCount()-$offer->getSeatsAvailableCount()) . ' of ' . $offer->getSeatsCount(); ?></div>
        <div class="listWarp3"><?php $p = SystemUtil::calcSoldPercentage($offer->getSeatsCount(), $offer->getSeatsAvailableCount()); if ($p) {echo $p . '%'; } else { echo '-'; } ?></div>
        <div class="editWarp"><a href="<?php echo url_for('@offer_edit?id=' . $offer->getId() . $expired); ?>#f"><?php if ($expired) : ?>View<?php else : ?>Edit<?php endif; ?></a></div>
        <div class="editWarp"><a href="<?php echo url_for('@offer_add?cid=' . $offer->getId()); ?>#f">Copy</a></div>
        <?php if ($offer->getStatus() == Constants::STATUS_ACTIVE) : ?><div><a href="<?php echo url_for('@offer_list_current?did=' . $offer->getId()); ?>"><img src="/images/admin/icon_cancel.gif" width="12" height="12" alt="Deactive" style="padding-top: 3px;" /></a></div><?php endif; ?>
      </div>
      <?php endforeach; ?>
      <?php endif; ?>
    </div>
  </div>
</div>